* Time parameter
gen timepara=0
replace timepara=1 if costtreat==1
replace timepara=1 if bentreat==1
replace timepara=2 if costtreat==2
replace timepara=2 if bentreat==2
replace timepara=3 if costtreat==3
replace timepara=3 if bentreat==3

* Cost treatment dummy
gen costdummy=1
replace costdummy=0 if bentreat<4

* New dichotomous high discounting measure where 1 is the median or greater discounting level
gen highdiscount_dummy=0
replace highdiscount_dummy=1 if discben==1

* Generating interaction terms for regression analysis
gen time_ideology=timepara*ideology
gen time_discount=timepara*highdiscount_dummy 
gen cost_ideology=costdummy*ideology

* Output
* Table 2
bootstrap, reps(2000): reg persact highdiscount_dummy costdummy timepara 
bootstrap, reps(2000): reg persact highdiscount_dummy costdummy timepara ideology 
bootstrap, reps(2000): reg persact highdiscount_dummy costdummy timepara ideology time_ideology
bootstrap, reps(2000): reg persact highdiscount_dummy costdummy timepara ideology time_discount
bootstrap, reps(2000): reg persact highdiscount_dummy costdummy timepara ideology cost_ideology

* Table 3
bootstrap, reps(2000): reg budgetincrease highdiscount_dummy costdummy timepara 
bootstrap, reps(2000): reg budgetincrease highdiscount_dummy costdummy timepara ideology 
bootstrap, reps(2000): reg budgetincrease highdiscount_dummy costdummy timepara ideology time_ideology
bootstrap, reps(2000): reg budgetincrease highdiscount_dummy costdummy timepara ideology time_discount
bootstrap, reps(2000): reg budgetincrease highdiscount_dummy costdummy timepara ideology cost_ideology

* Table 4
bootstrap, reps(2000): reg legissupport highdiscount_dummy costdummy timepara 
bootstrap, reps(2000): reg legissupport highdiscount_dummy costdummy timepara ideology 
bootstrap, reps(2000): reg legissupport highdiscount_dummy costdummy timepara ideology time_ideology
bootstrap, reps(2000): reg legissupport highdiscount_dummy costdummy timepara ideology time_discount
bootstrap, reps(2000): reg legissupport highdiscount_dummy costdummy timepara ideology cost_ideology

* Figure 1
drop _est_m1
reg budget ideologyby3##timepara
testparm  ideologyby3#timepara
estimates store m1
margins ideologyby3#timepara, asbalanced post
marginsplot

* Figure 2
drop _est_m1
reg legissupport ideologyby3##timepara
testparm  ideologyby3#timepara
estimates store m1
margins ideologyby3#timepara, asbalanced post
marginsplot

